package com.class05.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/11/8 16:21
 */
@Repository
public class StudentDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public void updateNameById(String name ,Integer id){
        String sql = "update students set name = ? where id = ?";
        int update = jdbcTemplate.update(sql, name, id);
        System.out.println("update = " + update);
    }
    public void updateAgeById(Integer age ,Integer id){
        String sql = "update students set age = ? where id = ?";
        int update = jdbcTemplate.update(sql, age, id);
        System.out.println("update = " + update);
    }
}
